﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadBatDongSanMoi();
    }

    private void LoadBatDongSanMoi()
    {
        List<NhaDatBaiDang> nhaDatBaiDangIndex = new NhatDatBaiDangManager().GetAllNhaDatIndex(34);
        string html = "";
        string htmlTooltip = "";
        foreach (NhaDatBaiDang aNhaDat in nhaDatBaiDangIndex)
        {
            html += string.Format("<li><a href=\"{0}\" onmouseover=\"ddrivetipvip('divTootipBdsCc_{1}');\" "
                        + " onmouseout=\"hideddrivetip();\"><b>{2}:</b> {3}</a><span class=\"price\">"
                        + "<font class=\"ColorStyle_1\">{4} {5}</font></span> </li>", "URL",
                        aNhaDat.ID, aNhaDat.Tinh, aNhaDat.TieuDe, aNhaDat.Gia, aNhaDat.DonVi.Ten);

            htmlTooltip += string.Format("<div id='divTootipBdsCc_{0}' class='propertyToolTip' style='display: none;'>", aNhaDat.ID);
            htmlTooltip += "<div class='ColImgs'>";
            htmlTooltip += "<img width='100' height='75' title='25122014145618205.JPG - ,' alt='25122014145618205.JPG - ,' src='../uploads.videonhadat.com.vn/Property/3098046/S/160x120/25122014145618205.jpg'>";
            htmlTooltip += "</div>";
            htmlTooltip += string.Format("<div class='ColDes'> <h3> {0}</h3>", aNhaDat.TieuDe);
            htmlTooltip += string.Format("<h4><span>{0} {1} </span><span>ID: {2}</span></h4>", aNhaDat.Gia, aNhaDat.DonVi.Ten, aNhaDat.ID);
            htmlTooltip += string.Format("<p>Địa chỉ:<span>{0}</span></p>", aNhaDat.DiaChi);
            htmlTooltip += "</div>";
            htmlTooltip += string.Format("<ul>" +
                            "<li><span>Diện tích:</span><span>{0}m<sup>2</sup> </span></li>" +
                            "<li><span>Pháp lý:</span><span>{1}</span></li>" +
                            "<li><span>Hướng:</span><span>{2}</span></li>" +
                            "</ul>", aNhaDat.DienTich, "", aNhaDat.HuongNha);
        }

        lBatDongSanMoi.Text = html;
        lBatDongSanMoiTooltip.Text = htmlTooltip;
    }
}